From bf5fa15b6fb42e2ffe77a89bbd0a739f77a8652e Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 2 Jun 2005 22:03:50 +0000 Subject: [PATCH] Don't crash if we don't have a placed/found time or a missing 'notes' field. --- gpsbabel/maggeo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gpsbabel/maggeo.c b/gpsbabel/maggeo.c index f2674a479..3bf237cc1 100644 --- a/gpsbabel/maggeo.c +++ b/gpsbabel/maggeo.c @@ -83,9 +83,9 @@ maggeo_fmtdate(time_t t) char *cbuf = xmalloc(SZ); struct tm *tm = NULL; int date; - tm = gmtime(&t); - if ( tm ) { + + if ( t && tm ) { date = tm->tm_mday * 100000 + (1+tm->tm_mon) * 1000 + tm->tm_year; snprintf(cbuf, SZ, "%07d", date); @@ -154,7 +154,7 @@ maggeo_waypt_pr(const waypoint *waypointp) ctype = gs_get_cachetype(waypointp->gc_data.type); placeddate = maggeo_fmtdate(waypointp->creation_time); lfounddate = maggeo_fmtdate(waypointp->gc_data.last_found); - cname = mkshort(desc_handle, waypointp->notes); + cname = mkshort(desc_handle, waypointp->notes ? waypointp->notes : waypointp->shortname); placer = waypointp->gc_data.placer; /* -- 2.30.2